<%--

<!------------------------------------------------------------------------------
 - Copyright 2006 CORE Solutions Limited
 - All rights reserved.
 - PROPRIETARY AND CONFIDENTIAL INFORMATION.
 - Use is subject to license terms.
 -
 - FUNCTION ID      :   CATALOG_OPTION
 - AUTHOR           :   Saint Peng 
 - DATE CREATE      :   2006/01/05
 - DESCRIPTION      :   a SEARCH CONTENT JSP file for the function, CODE
 -                  :   
 -                  :   
 -                  :   
 -
 - MODIFICATION HISTORY:
 - DATE         AUTHOR          VERSION NO.         COMMENT
 - -----------  --------------  ------------------  -------------------
 - 2006/01/05   Saint Peng      1.0                 source is generated.
 -
 -
 -
------------------------------------------------------------------------------->

--%>
<%@ include file="/jsp/com/erp/app/common/jsp/directives_include.jsp"%>

<%@ page import="com.erp.app.setup.catalogOption.vo.CatalogOptionHdrVo"%>
<%@ page import="com.erp.app.setup.catalogOption.web.CatalogOptionSearchAction"%>

<%@ include file="/jsp/com/erp/app/common/jsp/html_include.jsp"%>

<jsp:useBean id="catalogOptionSearchForm" scope="session" type="com.erp.app.setup.catalogOption.web.CatalogOptionSearchForm" />

<%
ArrayList catalogOptionList = catalogOptionSearchForm.getResultList();
pageContext.setAttribute("catalogOptionList", catalogOptionList);
TableSchema ts = catalogOptionSearchForm.getTs();
TableSchema[] childTsList = catalogOptionSearchForm.getChildTs();
//TableSchema dtlChildTs = childTsList[CatalogOptionSearchAction.TAB_IDX_DTL];
%>

<script language="javascript">

	function doLoad() {
		<%
		if (CommonUtil.nullToString((String)session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE)).equals(ProjectConstants.GENERIC_YES)) {
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE);
			out.println("alert('Records saved.');");
		}
		%>
	}

	function doEdit(val) {
		document.forms[0].editCodeNo.value = val;
		doSubmit('<%=catalogOptionSearchForm.ACTION_EDIT%>');
	}

</script>

<body onLoad="javascript:doLoad();autofill_init();">
<html:form action="/catalogOptionSearch">

<html:hidden property="pageEvent"/>
<html:hidden property="pageMode"/>
<html:hidden property="deleteIdx"/>
<html:hidden property="editCodeNo"/>

<table class="table_top">

<tr>
	<td>
		<chtml:button form="catalogOptionSearchForm" pageEvent="<%=CatalogOptionSearchAction.ACTION_EXIT%>"
			styleClass="button1"/>
		<chtml:button form="catalogOptionSearchForm" pageEvent="<%=CatalogOptionSearchAction.ACTION_SEARCH%>"
			styleClass="button1"/>
	</td>
</tr>

<tr>
	<td>

		<table class="table_crit_short">
		<tr>
			<td class="col_label">
				<html:text useExtensions="true" uiType="label" property="srchRefMasterCodeFr" />
			</td>
			<td class="col_value">
				<html:text useExtensions="true" uiType="text" property="srchRefMasterCodeFr" />
			</td>
		</tr>
		<tr>
			<td class="col_label">
				<html:text useExtensions="true" uiType="label" property="srchRefDescFr" />
			</td>
			<td class="col_value">
				<html:text useExtensions="true" uiType="text" property="srchRefDescFr" />
			</td>
		</tr>
		<tr>
			<td class="col_label">
				<html:text useExtensions="true" uiType="label" property="srchStatus" />
			</td>
			<td class="col_value">
				<html:text useExtensions="true" uiType="combobox" showCode="false" property="srchStatus" />
			</td>
		</tr>
		</table>
	</td>
</tr>

<tr>
	<td><font color='red'><html:errors/></font></td>
</tr>

<tr>
	<td class="grid_page" align="left">
	<%if (catalogOptionSearchForm.getTotalPage() == 0 ) {%>
		&nbsp;
	<%} else {%>
		<input type="button" value="Go" class="button1" onClick="javascript:doSubmit('<%=catalogOptionSearchForm.ACTION_SCROLL_TO%>');" >
		Page
		<html:text property="scrollTo" styleClass="textbox1" readonly="<%=rowReadOnly%>" maxlength="4" size="4" value="<%=String.valueOf(catalogOptionSearchForm.getCurrentPage())%>"/>
		of <%=catalogOptionSearchForm.getTotalPage()%>
	<%}%>
		<input type="button" value="|&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=catalogOptionSearchForm.ACTION_SCROLL_TO_FIRST_PAGE%>');" <%=catalogOptionSearchForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=catalogOptionSearchForm.ACTION_SCROLL_LEFT%>');" <%=catalogOptionSearchForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&gt;&gt;" class="button1" onClick="javascript:doSubmit('<%=catalogOptionSearchForm.ACTION_SCROLL_RIGHT%>');" <%=catalogOptionSearchForm.getSidx() < Integer.parseInt(catalogOptionSearchForm.getLastPageSidx()) ? "" : "disabled"%>>
		<input type="button" value="&gt;&gt|" class="button1" onClick="javascript:doSubmit('<%=catalogOptionSearchForm.ACTION_SCROLL_TO_LAST_PAGE%>');" <%=catalogOptionSearchForm.getSidx() < Integer.parseInt(catalogOptionSearchForm.getLastPageSidx()) ? "" : "disabled"%>>
	</td>
</tr>

</table>
<table class="table_grid">

	<tr class="grid_header">
		<td class="grid_header_col" nowrap>
			<html:text useExtensions="true" uiType="label" childTsIndex="current" property="lblGridRefMasterCode" />
		</td>
		<td class="grid_header_col" nowrap>
			<html:text useExtensions="true" uiType="label" childTsIndex="current" property="lblGridRefDesc" />
		</td>
		<td class="grid_header_col" nowrap>
			<html:text useExtensions="true" uiType="label" childTsIndex="current" property="lblGridStatus" />
		</td>
	</tr>

	<logic:iterate id="srchRsltRow" name="catalogOptionList" indexId="idx" length="<%=String.valueOf(ProjectConstants.MAX_DISPLAY)%>" offset="<%=String.valueOf(catalogOptionSearchForm.getSidx())%>">

	<%
		CatalogOptionHdrVo row = (CatalogOptionHdrVo) srchRsltRow;
		String gridStyle = (idx.intValue()%2 == 0) ? "grid_result1" : "grid_result2";
	%>

	<% if(row != null) {%>
	<tr class="<%=gridStyle%>" onmouseover="mouseOverHighlight(event,'grid_row_action_hilite')"
	onmouseout="mouseOutHighlight('<%=gridStyle%>')"
	onclick="javascript:doEdit('<%=StringUtil.escapeSlash(row.getRefMasterCode(), "'") %>')">
		<td class="grid_outline" nowrap><html:text useExtensions="true" uiType="write" name="srchRsltRow" property="refMasterCode" /></td>
		<td class="grid_outline" nowrap><html:text useExtensions="true" uiType="write" name="srchRsltRow" property="refDesc" /></td>
		<td class="grid_outline" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="srchRsltRow" property="status" 
				visibility="displayOnly" showDescription="true" showCode="false"/>
		</td>
	</tr>

	<% } // end if(row != null) %>

	</logic:iterate>

</table>

</html:form>
